<?php

Route::get('/', function()
{
	// return View::make('hello');
    return Config::get('dbConfig.host');
});

Route::group(['prefix' => 'config'], function(){

        Route::post('db', 'ConfigController@dbConfig');
        Route::post('register', 'UserController@create');
});

Route::group(['prefix' => 'admin'], function(){
    Route::get('login', function(){
        return View::make('login');
    });
    Route::post('login', 'UserController@login');

    Route::group(['before' => 'auth'], function(){
        Route::group(['prefix' => 'model'], function(){
            Route::post('add', 'ModelController@add');
            Route::post('delete', 'ModelController@delete');
            Route::post('update', 'ModelController@update');
            Route::get('show', 'ModelController@show');
            Route::get('index', 'ModelController@index');
        });

        Route::group(['prefix' => 'field'], function(){
            Route::post('add', 'FieldController@add');
            Route::post('delete', 'FieldController@delete');
            Route::post('update', 'FieldController@update');
            Route::get('index', 'FieldController@index');
        });

        Route::group(['prefix' => 'category'], function(){
            Route::post('add', 'CategoryController@add');
            Route::post('delete', 'CategoryController@delete');
            Route::post('update', 'CategoryController@update');
            Route::get('index', 'CategoryController@index');
        });
        
        Route::group(['prefix' => 'document'], function(){
            Route::post('add', 'DocumentController@add');
            Route::post('delete', 'DocumentController@delete');
            Route::post('update', 'DocumentController@update');
            Route::get('index', 'DocumentController@index');
        });

        Route::get('logout', 'UserController@logout');
    });
});

try{
    include(app_path().'/test_route.php');
}catch(Exception $e){}

